﻿using System;
using DMS.Business.Modules.Organization;
using DMS.Business.Utility;
using DMS.BaseClass;

namespace DMS.Web.Common.Controls
{
    public partial class UserContextMenu : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void lbtnDel_Click(object sender, EventArgs e)
        {
            string arg = Request["__EVENTARGUMENT"].ToString();
            Role role = null;
            string script = string.Empty;

            try
            {
                string roleID = arg;
                role = UserHelper.GetRoleByID(roleID);
                role.Delete();

                ClientHelper.Instance.Alert("操作成功！");
            }
            catch (LogicException ex)
            {
                string code = LogHelper.LogException(ex);
                string msg = ex.Message;
                ClientHelper.Instance.Alert(msg);
            }
            catch (Exception ex)
            {
                string code = LogHelper.LogException(ex);
                string msg = string.Format("删除失败，请联系管理员。\\r\\n错误码：{0}", code);
                ClientHelper.Instance.Alert(msg);
            }

            ClientHelper.Instance.RefreshPage();
        }
    }
}